package Practice3;

public class Circle {
    private double radius;
    public Circle(double radius) {
        if(radius <= 0) {
            this.radius = 1.0;
        }else{
            this.radius = radius;
        }
    }
    public double getRadius() {
        return radius;
    }
    public void setRadius(double radius) {
        if(radius <= 0) {
           this.radius = 1.0;
        }else {
           this.radius = radius;
        }
    }
    public double getArea() {
        return radius*radius*Math.PI;
    }
    public void print() {
        System.out.println("圆的面积为"+getArea());
    }
}
